
package com.app.hmst.model;

import java.util.List;

import com.app.hmst.dto.Sub_categories;
import com.roscopeco.ormdroid.Entity;


public class HomestayVO extends Entity{
   
	public int id;
	public String title;
	public String type;

	public HomestayVO(){
		this(null,null);
	}
	
 	public HomestayVO(String title,String type){
 		this.title = title;
 		this.type = type;
 	}
 	public List<CategoryVO> categories() {
		return query(CategoryVO.class).where("homestayId").eq(id).executeMulti();
	}
 	public int getFormSize(HomestayVO homestayVO){
 		int size = 0;
 		
 		List<CategoryVO> catList = homestayVO.categories();
 		if(catList!=null){
 			for(CategoryVO cat :catList){
 				List<SubCategoryVO> subList = cat.subCategories();
 				if(subList!=null){
 					for(SubCategoryVO sub :subList){
 						List<IndicatorVO> indList = sub.indicators();
 						if(indList!=null){
 							size += indList.size();
 						}
 					}
 				}
 			}
 		}
 		
 		
 		return size;
 	}
}
